/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package persistencia;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;

/**
 *
 * @author Mila
 */
public class DBManagerPacientes {
 
    public static Connection conexion;
    private static Statement s;

    public DBManagerPacientes() throws ClassNotFoundException, SQLException {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conexion = DriverManager.getConnection("jdbc:mysql://localhost/bbdd_gestmotor", "dam2014", "dam2014");
        } catch (ClassNotFoundException ex) {
            System.err.println("ERROR. DBManager(). Error al cargar el driver JDBC de MYSQL");
            throw ex;
        } catch (SQLException ex) {
            System.err.println("ERROR. DBManager(). Error de SQL");
            JOptionPane.showMessageDialog(null, "La base de Datos No esta Conectada");
            throw ex;
        }
    }
    
    public void closeConnection() throws java.sql.SQLException {
        try {
            conexion.close();
        } catch (SQLException ex) {
            System.err.println("ERROR. DBManager.closeConnection(). Error al cerrar la conexion");
            throw ex;
        }
    }
}
